import pandas as pd
from autogluon.tabular import TabularDataset, TabularPredictor
import warnings

warnings.filterwarnings('ignore')

train_data = pd.read_csv('train.csv')
test_data = pd.read_csv('test.csv')

train = TabularDataset(train_data.drop(['uuid'], axis=1))
test = TabularDataset(test_data.drop(['uuid'], axis=1))

predictor = TabularPredictor(label='target',
                             problem_type='binary',
                             eval_metric='f1').fit(train_data=train,
                                                   presets='best_quality')
predictor.delete_models(models_to_keep='best')
# 输出最优模型
predictor.get_model_best()
y_pred = predictor.predict(test)
df = y_pred
df.to_csv('result.csv', mode='w', index=0)
